home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 17 / AMIGAplus Sonderheft 17 (1999)(ICP)(DE)[!].iso / Rexx / MakeIcons.pprx < prev    next >
Text File  |  1997-05-11  |  30KB  |  885 lines

  1. /* Personal Paint Amiga Rexx script - Copyright © 1996, 1997 Cloanto Italia srl */
  2.  
  3. /* $VER: MakeIcons.pprx 1.2 */
  4.  
  5. /** ENG
  6.  This script creates icons for the picture and animation files in
  7.  the specified path. No icons are created or modified for unrecognized
  8.  types of files (e.g. texts or executable programs). The artwork files
  9.  are not modified or rewritten - only the icon files are.
  10.  
  11.  The settings requester allows the user to set several parameters
  12.  which affect the creation of the icons:
  13.  
  14.  - Icon Type: Default (default icon images), Picture (reduced thumbnail
  15.  pictures for image, brush, animation and anim-brush files), NewIcons+Def
  16.  (reduced thumbnail pictures in NewIcons format, the default images are
  17.  used for the standard icon image), NewIcons+Dot (reduced thumbnail pictures
  18.  in NewIcons format, a small "dot" standard image is used to save
  19.  disk space).
  20.  
  21.  - File Type: Auto (picture files are saved as images or brushes, based
  22.  on their format), Image (picture files are saved as images, if possible),
  23.  Brush (picture files are always saved as brushes).
  24.  
  25.  - Width: maximum width of the picture icons.
  26.  
  27.  - Height: maximum height of the picture icons.
  28.  
  29.  - Icon Palette: Standard (the first four and the last four Workbench
  30.  colors are used for Picture icons, and the standard 16 colors palette
  31.  is used for NewIcons), Best (all Workbench pens are used for Picture
  32.  icons, and the full original picture palette is used for NewIcons),
  33.  Standard (Gray) (same as Standard, but only gray shades are used), Best
  34.  (Gray) (same as Best, but only gray shades are used).
  35.  
  36.  - Color Average: when this option is active, reduced picture icons
  37.  are generated with a color average algorithm. This improves the
  38.  quality, but slows down the creation of the icons.
  39.  
  40.  - Animation Frame: First (the first frame is used for
  41.  the picture icons of animation/anim-brushes), Central (the
  42.  middle frame is used), Last (the last frame is used), Manual Selection
  43.  (a frame selection requester is opened for every animation loaded, and
  44.  the middle frame is used for anim-brushes).
  45.  
  46.  - Target: Existing Icons (new icons are only created for files which
  47.  already have an icon), All Files (icons are created for all image, brush,
  48.  animation, anim-brush, palette and stencil files).
  49.  
  50.  - Subdirectories: when this option is active, the script processes not
  51.  only the specified directory, but also all subdirectories.
  52.  
  53.  - Work Directory: this is the directory in which the script stores
  54.  the temporary files from which it then copies the new icons. The
  55.  storage unit should have sufficient space to store at least the largest
  56.  file.
  57.  
  58.  After the settings requester is closed, a path requester is used to
  59.  select the target directory.
  60.  
  61.  The "Color Reduction" and "Dithering" program settings also affect the
  62.  quality of the reduced picture icons, because some pictures/brushes may be
  63.  color-reduced before being loaded.
  64.  
  65.  In some circumstances, if the script runs while the user interacts
  66.  with the Workbench, the Workbench Update menu item must be selected in
  67.  order to visually update the icons in modified by this script.
  68.  
  69.  When creating reduced picture icons, it is recommended to set the "Brush"
  70.  file type, so that all icons can have the proper ratio, even if a
  71.  matching video mode is unavailable.
  72.  
  73.  When icons are created with the Picture type setting, the script uses
  74.  the current Workbench (number of colors, palette, ratio) as a reference
  75.  to create the icons. NewIcons icons, instead, are more independent from
  76.  the environment in which they were created, since only the aspect ratio
  77.  of the Workbench screen is checked before creating NewIcons.
  78.  
  79.  Personal Paint's default icons, stored in "PPaint_Icons", can be freely
  80.  modified to change the default icon image, and the Tool Types and Default
  81.  Tool for each file type.
  82. */
  83.  
  84. /** DEU
  85.  Mit Hilfe dieses Skripts lassen sich Piktogramme für Bild- und
  86.  Animationsdateien unter dem angegebenen Pfad erstellen. Es ist jedoch nicht
  87.  möglich, für unbekannte Dateitypen (z. B. Texte oder ausführbare Programme)
  88.  Piktogramme zu erstellen. Die Bilder und Animationen selbst werden nicht
  89.  modifiziert, sondern ausschließich die Piktogrammdateien.
  90.  
  91.  Im Dialogfenster "Einstellungen" lassen sich verschiedene Parameter zur
  92.  Festlegung bestimmter Eigenschaften für die Piktogramme einstellen:
  93.  
  94.  - Typ: Standard (Standard-Piktogramme), Bild (Kleingrafiken von Bildern,
  95.    Pinseln, Animationen und Animationspinseln), NewIcons+Def (Kleingrafiken im
  96.    NewIcons-Format, wobei Standardbilder für das Standardpiktogramm verwendet
  97.    werden), NewIcons+Dot (Kleingrafiken im NewIcons-format, wobei ein kleines
  98.    "Dot"-Standardbild benutzt wird, um den Plattenspeicherbedarf zu verringern.
  99.  
  100.  - Dateityp: Auto (Bilddateien werden, abhängig von ihrem Format, entweder
  101.    als Bilder oder Pinsel gespeichert), Bild (Bilddateien werden, sofern
  102.    möglich, als Bilder gespeichert), Pinsel (Bilddateien werden grundsätzlich
  103.    als Pinsel gespeichert).
  104.  
  105.  - Breite: Maximale Breite der Bild-Piktogramme.
  106.  
  107.  - Height: Maximale Höhe der Bild-Piktogramme.
  108.  
  109.  - Piktogrammpalette: Standard (für Bild-Piktogramme werden die ersten und
  110.    letzten 4 Farben der Workbenchpalette verwendet, die normale 16
  111.    Farben-Palette für NewIcons), Beste (für Bild-Piktogramme werden alle 16
  112.    Workbench-Pens verwendet, für NewIcons die volle Bildpalette), Standard
  113.    (Grau) (wie Standard, allerdings werden nur Graustufen verwendet), Beste
  114.    (Grau) (wie Beste, allerdings werden nur Graustufen verwendet).
  115.  
  116.  - Farbmittelwert: Wenn diese Option aktiviert ist, werden die
  117.    Piktogramm-Kleingrafiken auf der Grundlage eines besonderen Algorithmusses
  118.    erzeugt. Die hierdurch erzielte bessere Qualität wird allerdings mit einer
  119.    längeren Erstellungsdauer erkauft.
  120.  
  121.  - Anim-Bild: Erstes (für Grafik-Piktogramme wird das erste Bild der
  122.    Animation oder des Animationspinsels verwendet), Mittleres (verwendet das
  123.    mittlere Einzelbild), Manuelle Auswahl (öffnet ein Auswahlfenster zur
  124.    Festlegung des gewünschten Bildes bei jeder geladenen Animation, bei
  125.    Animationspinseln wird automatisch das mittlere Bild verwendet).
  126.  
  127.  - Ziel: Existierende Piktogramme (neue Piktogramme werden nur für Dateien
  128.    erstellt, die bereits über ein älteres Piktogramm verfügen) alle Dateien
  129.    (erzeugt für alle Bild-, Pinsel-, Animationspinsel-, Paletten- und
  130.    Maskendateien ein neues Piktogramm.
  131.  
  132.  - Unterverzeichnis: Ist diese Option aktiviert, so werden nicht nur das
  133.    angegebene Verzeichnis, sondern auch alle darin enthaltenen
  134.    Unterverzeichnisse verarbeitet.
  135.  
  136.  - Arbeitsverzeichnis: In diesem Verzeichnis speichert das Skript seine
  137.    temporären Daten zur Erzeugung der neuen Piktogramme. Das betreffende
  138.    Speichermedium sollte zumindest noch genügend Platz zum Speichern der
  139.    größten Datei aufweisen.
  140.  
  141.  Nachdem das Einstellungen-Fenster geschlossen worden ist, muß in einem
  142.  Pfadauswahlfenster der gewünschte Zielpfad eingestellt werden.
  143.  
  144.  Die Programmeinstellungen "Farbreduzierung" und "Fehlerverteilung" wirken
  145.  sich ebenfalls möglicherweise auf die Qualität der Piktogrammgrafiken aus,
  146.  da einige Bilder oder Pinsel evtl schon beim Laden eine Reduzierung ihrer
  147.  Farbanzahl erfahren.
  148.  
  149.  Unter bestimmten Umständen (wenn dieses Skript läuft, während der Benutzer
  150.  mit der Workbench interagiert, muß im Workbench-Menü der Amiga Workbench der
  151.  Menübefehl "Bild neu aufbauen" ausgewählt werden, um die Darstellung der mit
  152.  diesem Skript erzeugten Piktogramme zu aktualisieren.
  153.  
  154.  Bei der Erzeugung von Piktogramm-Kleingrafiken wird empfohlen, als Dateityp
  155.  "Pinsel" einzustellen. Dadurch wird gewährleistet, daß alle Piktogramme auch
  156.  dann mit einem korrekten Größenverhältnis dargestellt werden, wenn kein
  157.  passender Videomodus verfügbar ist.
  158.  
  159.  Wenn die Piktogramme unter Verwendung des Dateityps "Bild" erzeugt werden,
  160.  werden die aktuellen Workbench-Einstellungen (Farbanzahl, Palette,
  161.  Höhen-/Breitenverhältnis als Referenz verwendet. NewIcons-Piktogramme
  162.  hingegen sind von der Umgebung, in der sie erzeugt wurden, sehr viel
  163.  unabhängiger, da hier lediglich das Höhen-/Breitenverhältnis der Workbench
  164.  überprüft wird.
  165.  
  166.  Um das Erscheinungsbild des standardmäßig verwendeten Piktogramms zu
  167.  ändern, lassen sich die in "PPaint_Icons" gespeicherten Standardpiktogramme
  168.  von Personal Paint beliebig modifizieren und mit anderen Merkmalen und
  169.  Standardprogrammen verrsehen.
  170. */
  171.  
  172. /** ITA
  173.  Questo script crea le icone per i file delle immagini e delle animazioni nel
  174.  percorso specificato. Non sono create o modificate le icone relative a
  175.  file di tipo non riconosciuto (es. testi o programmi eseguibili). I file
  176.  grafici non vengono modificati o riscritti - ciò avviene solo per i file
  177.  delle icone (".info").
  178.  
  179.  La finestra di impostazione parametri permette di scegliere vari parametri
  180.  che influenzano la creazione delle icone:
  181.  
  182.  - Tipo di icona: Standard (immagini predefinite per icone), Immagine ridotta
  183.    (immagini in miniatura per disegni, pennelli, animazioni, anim-brush),
  184.    NewIcons+Std (immagini in miniatura in formato NewIcons, mentre per l'icona
  185.    standard si usa l'immagine predefinita), NewIcons+Punto (immagini in miniatura
  186.    in formato NewIcons, mentre si usa l'immagine standard di un piccolo "punto"
  187.    per risparmiare spazio su disco).
  188.  
  189.  - Tipo di file: Auto (i file dei disegni sono salvati come immagini o
  190.    pennelli, in base al loro formato), Immagine (i file dei disegni sono salvati
  191.    come immagini, se possibile), Pennello (i file dei disegni sono salvati sempre
  192.    come pennelli).
  193.  
  194.  - Larghezza: la larghezza massima delle immagini per icone.
  195.  
  196.  - Altezza: l'altezza massima delle immagini per icone.
  197.  
  198.  - Colori icona: Standard (si usano i primi quattro e gli ultimi quattro colori
  199.    del Workbench per le icone del tipo Immagine ridotta, e la tavolozza standard
  200.    a 16 colori per quelle del tipo NewIcons), Ottimali (si usano tutti i colori
  201.    del Workbench per le icone del tipo Imagine ridotta, e la tavolozza completa
  202.    originale per quelle del tipo NewIcons), Standard (grigi) (come Standard, ma
  203.    si usano solo toni di grigio), Ottimali (grigi) (come Ottimali, ma si usano
  204.    solo toni di grigio).
  205.  
  206.  - Media cromatica: quando questa opzione è attiva, le icone del tipo Immagine
  207.    ridotta sono create tramite un algoritmo che calcola la media cromatica. Ciò
  208.    migliora la loro qualità, ma rallenta la creazione delle icone.
  209.  
  210.  - Fotogramma animazione: Primo (si usa il primo fotogramma per l'icona del
  211.    tipo Immagine ridotta per l'animazione/anim-brush), Centrale (si usa il
  212.    fotogramma centrale), Ultimo (si usa l'ultimo fotogramma), Selezionare
  213.    (si apre la finestra di dialogo per la scelta del fotogramma per ogni
  214.    animazione caricata, e si usa il fotogramma centrale per anim-brush).
  215.  
  216.  - Operare su: Icone esistenti (sono create nuove icone solo per i file che
  217.    già hanno un'icona), Tutti i file (si creano icone per tutti i file relativi
  218.    a disegni, pennelli, animazioni, anim-brush, tavolozze e maschere colori).
  219.  
  220.  - Tutti i cassetti: quando questa opzione è attiva, lo script opera non solo
  221.    sul cassetto specificato, ma anche su tutti i cassetti presenti al suo interno.
  222.  
  223.  - Cassetto di lavoro: questo è il cassetto in cui lo script immagazzina i file
  224.    temporanei da cui poi copia le nuove icone. L'unità di memorizzazione dovrebbe
  225.    avere spazio sufficiente per immagazzinare almeno il file più esteso.
  226.  
  227.  Dopo la chiusura della finestra di dialogo per l'impostazione dei parametri,
  228.  compare una finestra di dialogo per la scelta del percorso relativo al
  229.  cassetto di destinazione
  230.  
  231.  Anche i parametri "Riduzione colori" e "Adattamento colori" del programma
  232.  influenzano la qualità delle icone del tipo Immagine ridotta, poiché alcuni
  233.  disegni/pennelli possono subire una riduzione dei colori prima di essere
  234.  caricati.
  235.  
  236.  In alcuni casi, se lo script è attivo mentre l'utente interagisce col
  237.  Workbench, si dovrebbe selezionare la voce Aggiornare tutto del menu Workbench
  238.  per poter aggiornare la visualizzazione delle icone modificate dallo script.
  239.  
  240.  Quando si creano icone del tipo Immagine ridotta, è consigliabile impostare il
  241.  tipo di file a "Pennello", per far sì che tutte le icone abbiano un aspetto
  242.  adeguato, anche se non è disponibile un modo video che si accordi.
  243.  
  244.  Quando si creano icone del tipo Immagini ridotte, lo script usa il Workbench
  245.  attuale (numero di colori, tavolozza, aspetto) come riferimento per creare
  246.  le icone. Le icone del tipo NewIcons, invece, sono più slegate dall'ambiente
  247.  in cui sono create, dato che si controlla solo l'aspetto dello schermo del
  248.  Workbench prima di creare icone NewIcons.
  249.  
  250.  Le icone predefinte di Personal Paint, memorizzate in "PPaint_Icons",
  251.  possono essere liberamente modificate per cambiare l'immagine standard della
  252.  icona, i parametri e il programma associato per ciascun tipo di file.
  253. */
  254.  
  255. IF ARG(1, EXISTS) THEN
  256.     PARSE ARG PPPORT
  257. ELSE
  258.     PPPORT = 'PPAINT'
  259.  
  260. IF ~SHOW('P', PPPORT) THEN DO
  261.     IF EXISTS('PPaint:PPaint') THEN DO
  262.         ADDRESS COMMAND 'Run >NIL: PPaint:PPaint'
  263.         DO 30 WHILE ~SHOW('P',PPPORT)
  264.              ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  265.         END
  266.     END
  267.     ELSE DO
  268.         SAY "Personal Paint could not be loaded."
  269.         EXIT 10
  270.     END
  271. END
  272.  
  273. IF ~SHOW('P', PPPORT) THEN DO
  274.     SAY 'Personal Paint Rexx port could not be opened'
  275.     EXIT 10
  276. END
  277.  
  278. ADDRESS VALUE PPPORT
  279. OPTIONS RESULTS
  280. OPTIONS FAILAT 10000
  281.  
  282. Get 'LANG'
  283. IF RESULT = 1 THEN DO        /* Deutsch */
  284.     txt_title_set     = "Piktogramm-Einstellungen"
  285.     txt_title_path    = "Zielverzeichnis"
  286.     txt_title_frame   = "Piktogramm-Bild"
  287.     txt_gad_itype     = "_Piktogramm-Typ:"
  288.     txt_gad_itype0    = "Standard"
  289.     txt_gad_itype1    = "Bild"
  290.     txt_gad_itype2    = "NewIcons+Def"
  291.     txt_gad_itype3    = "NewIcons+Dot"
  292.     txt_gad_ftype     = "_Dateityp:"
  293.     txt_gad_ftype0    = "Auto"
  294.     txt_gad_ftype1    = "Bild"
  295.     txt_gad_ftype2    = "Pinsel"
  296.     txt_gad_width     = "Max _Breite:"
  297.     txt_gad_height    = "Max _Höhe:"
  298.     txt_gad_icnplt    = "Piktogra_mm Palette:"
  299.     txt_gad_icnplt0   = "Standard"
  300.     txt_gad_icnplt1   = "Beste"
  301.     txt_gad_icnplt2   = "Standard (Grau)"
  302.     txt_gad_icnplt3   = "Best (Grau)"
  303.     txt_gad_cavrg     = "_Farb-Mittelwert:"
  304.     txt_gad_animfr    = "A_nim-Bild:"
  305.     txt_gad_animfr0   = "Erstes"
  306.     txt_gad_animfr1   = "Mitte"
  307.     txt_gad_animfr2   = "Letztes"
  308.     txt_gad_animfr3   = "Manuelle Auswahl:"
  309.     txt_gad_target    = "_Ziel:"
  310.     txt_gad_target0   = "Alle Dateien"
  311.     txt_gad_target1   = "Existierende Pikt."
  312.     txt_gad_recurse   = "_Unterverzeichnisse:"
  313.     txt_gad_workdir   = "Arbeits_verzeichnis:"
  314.     txt_gad_frame     = "_Bild:"
  315.     txt_gad_show      = "_Zeigen"
  316.     txt_err_load      = "Fehler beim Laden: "
  317.     txt_err_save      = "Fehler beim Speichern: "
  318.     txt_err_format    = "Fehler bei Formatänderung: "
  319.     txt_err_oldclient = "Dieses Skript erfordert eine neuere_Version von Personal Paint"
  320. END
  321. ELSE IF RESULT = 2 THEN DO    /* Italiano */
  322.     txt_title_set     = "Parametri icone"
  323.     txt_title_path    = "Selezionare cassetto"
  324.     txt_title_frame   = "Selezionare fotogramma"
  325.     txt_gad_itype     = "Tipo di ic_ona:"
  326.     txt_gad_itype0    = "Standard"
  327.     txt_gad_itype1    = "Immagine ridotta"
  328.     txt_gad_itype2    = "NewIcons+Std"
  329.     txt_gad_itype3    = "NewIcons+Punto"
  330.     txt_gad_ftype     = "Tipo di _file:"
  331.     txt_gad_ftype0    = "Auto"
  332.     txt_gad_ftype1    = "Immagine"
  333.     txt_gad_ftype2    = "Pennello"
  334.     txt_gad_width     = "_Larghezza massima:"
  335.     txt_gad_height    = "Al_tezza massima:"
  336.     txt_gad_icnplt    = "Colo_ri icona:"
  337.     txt_gad_icnplt0   = "Standard"
  338.     txt_gad_icnplt1   = "Ottimali"
  339.     txt_gad_icnplt2   = "Standard (grigi)"
  340.     txt_gad_icnplt3   = "Ottimali (grigi)"
  341.     txt_gad_cavrg     = "M_edia cromatica:"
  342.     txt_gad_animfr    = "Fotogra_mma animazione:"
  343.     txt_gad_animfr0   = "Primo"
  344.     txt_gad_animfr1   = "Centrale"
  345.     txt_gad_animfr2   = "Ultimo"
  346.     txt_gad_animfr3   = "Selezionare"
  347.     txt_gad_target    = "Operare _su:"
  348.     txt_gad_target0   = "Icone esistenti"
  349.     txt_gad_target1   = "Tutti i file"
  350.     txt_gad_recurse   = "Tutti i _cassetti:"
  351.     txt_gad_workdir   = "Cassetto di la_voro:"
  352.     txt_gad_frame     = "_Fotogramma:"
  353.     txt_gad_show      = "_Mostrare"
  354.     txt_err_load      = "Errore nella lettura: "
  355.     txt_err_save      = "Errore nella scrittura: "
  356.     txt_err_format    = "Errore nel cambio formato: "
  357.     txt_err_oldclient = "Questa procedura richiede_una versione più recente_di Personal Paint"
  358. END
  359. ELSE DO                /* English */
  360.     txt_title_set     = "Icon Settings"
  361.     txt_title_path    = "Target Directory"
  362.     txt_title_frame   = "Icon Frame"
  363.     txt_gad_itype     = "_Icon Type:"
  364.     txt_gad_itype0    = "Default"
  365.     txt_gad_itype1    = "Picture"
  366.     txt_gad_itype2    = "NewIcons+Def"
  367.     txt_gad_itype3    = "NewIcons+Dot"
  368.     txt_gad_ftype     = "_File Type:"
  369.     txt_gad_ftype0    = "Auto"
  370.     txt_gad_ftype1    = "Image"
  371.     txt_gad_ftype2    = "Brush"
  372.     txt_gad_width     = "Max _Width:"
  373.     txt_gad_height    = "Max _Height:"
  374.     txt_gad_icnplt    = "Icon _Palette:"
  375.     txt_gad_icnplt0   = "Standard"
  376.     txt_gad_icnplt1   = "Best"
  377.     txt_gad_icnplt2   = "Standard (Gray)"
  378.     txt_gad_icnplt3   = "Best (Gray)"
  379.     txt_gad_cavrg     = "Color A_verage:"
  380.     txt_gad_animfr    = "_Animation Frame:"
  381.     txt_gad_animfr0   = "First"
  382.     txt_gad_animfr1   = "Central"
  383.     txt_gad_animfr2   = "Last"
  384.     txt_gad_animfr3   = "Manual Selection"
  385.     txt_gad_target    = "_Target:"
  386.     txt_gad_target0   = "All Files"
  387.     txt_gad_target1   = "Existing Icons"
  388.     txt_gad_recurse   = "_Subdirectories:"
  389.     txt_gad_workdir   = "Work _Directory:"
  390.     txt_gad_frame     = "_Frame:"
  391.     txt_gad_show      = "_Show"
  392.     txt_err_load      = "Error during load: "
  393.     txt_err_save      = "Error during save: "
  394.     txt_err_format    = "Error in format change: "
  395.     txt_err_oldclient = "This script requires a newer_version of Personal Paint"
  396. END
  397.  
  398. Version 'REXX'
  399. rexx_ver = RESULT
  400. IF rexx_ver < 7 THEN DO
  401.     RequestNotify 'PROMPT "'txt_err_oldclient'"'
  402.     EXIT 10
  403. END
  404.  
  405. FreeEnvironment 'QUERY'
  406. IF RC ~= 0 THEN
  407.     EXIT RC
  408. FreeBrush
  409. IF RC ~= 0 THEN
  410.     EXIT RC
  411.  
  412. rexx_to_iconset.0 = 1
  413. rexx_to_iconset.1 = 2
  414. rexx_to_iconset.2 = 4
  415. rexx_to_iconset.3 = 4
  416.  
  417. iconset_to_rexx.0 = 0
  418. iconset_to_rexx.1 = 0
  419. iconset_to_rexx.2 = 1
  420. iconset_to_rexx.3 = 0
  421. iconset_to_rexx.4 = 2
  422.  
  423. conv_icnplt.0 = 0
  424. conv_icnplt.1 = 1
  425. conv_icnplt.2 = 0
  426. conv_icnplt.3 = 1
  427.  
  428. Get 'ICONS'
  429. save_icons = RESULT
  430.  
  431.  
  432. /* Settings Requester */
  433.  
  434. itype   = LoadSet('IconType',  iconset_to_rexx.save_icons)
  435. ftype   = LoadSet('FileType',  0)
  436. width   = LoadSet('MaxWidth',  80)
  437. height  = LoadSet('MaxHeight', 80)
  438. icnplt  = LoadSet('IconPlt',   0)
  439. cavrg   = LoadSet('ColAvrg',   0)
  440. animfr  = LoadSet('AnimFrame', 1)
  441. target  = LoadSet('Target',    0)
  442. recurse = LoadSet('Recurse',   1)
  443. tempdir = LoadSet('TempDir',   'T:')
  444.  
  445. max_tempdir_size = 80
  446.  
  447. LockGUI
  448. Request '"'txt_title_set'" COMPACT ' ||,
  449.         '"CYCLE = ""'txt_gad_itype'"", 4, 'itype', ""'txt_gad_itype0'"", ""'txt_gad_itype1'"", ""'txt_gad_itype2'"", ""'txt_gad_itype3'"" ' ||,
  450.          'VSPACE = 3 ' ||,
  451.          'CYCLE = ""'txt_gad_ftype'"", 3, 'ftype', ""'txt_gad_ftype0'"", ""'txt_gad_ftype1'"", ""'txt_gad_ftype2'"" ' ||,
  452.          'VSPACE = 2 ' ||,
  453.          'INTSTR = ""'txt_gad_width'"", 1, 32000, 'width' ' ||,
  454.          'VSPACE = 2 ' ||,
  455.          'INTSTR = ""'txt_gad_height'"", 1, 32000, 'height' ' ||,
  456.          'VSPACE = 2 ' ||,
  457.          'CYCLE = ""'txt_gad_icnplt'"", 4, 'icnplt', ""'txt_gad_icnplt0'"", ""'txt_gad_icnplt1'"", ""'txt_gad_icnplt2'"", ""'txt_gad_icnplt3'"" ' ||,
  458.          'VSPACE = 3 ' ||,
  459.          'CHECK = ""'txt_gad_cavrg'"", 'cavrg' ' ||,
  460.          'VSPACE = 3 ' ||,
  461.          'CYCLE = ""'txt_gad_animfr'"", 4, 'animfr', ""'txt_gad_animfr0'"", ""'txt_gad_animfr1'"", ""'txt_gad_animfr2'"", ""'txt_gad_animfr3'"" ' ||,
  462.          'VSPACE = 3 ' ||,
  463.          'CYCLE = ""'txt_gad_target'"", 2, 'target', ""'txt_gad_target0'"", ""'txt_gad_target1'"" ' ||,
  464.          'VSPACE = 3 ' ||,
  465.          'CHECK = ""'txt_gad_recurse'"", 'recurse' ' ||,
  466.          'VSPACE = 2 ' ||,
  467.             'STRING = ""'txt_gad_workdir'"", 'max_tempdir_size', ""'tempdir'"" ' ||,
  468.          'VSPACE = 3 "'
  469. IF RC = 0 THEN DO
  470.     itype   = RESULT.1
  471.     ftype   = RESULT.2
  472.     width   = RESULT.3
  473.     height  = RESULT.4
  474.     icnplt  = RESULT.5
  475.     cavrg   = RESULT.6
  476.     animfr  = RESULT.7
  477.     target  = RESULT.8
  478.     recurse = RESULT.9
  479.     tempdir = RESULT.10
  480.  
  481.     CALL SaveSet('IconType',  itype)
  482.     CALL SaveSet('FileType',  ftype)
  483.     CALL SaveSet('MaxWidth',  width)
  484.     CALL SaveSet('MaxHeight', height)
  485.     CALL SaveSet('IconPlt',   icnplt)
  486.     CALL SaveSet('ColAvrg',   cavrg)
  487.     CALL SaveSet('AnimFrame', animfr)
  488.     CALL SaveSet('Target',    target)
  489.     CALL SaveSet('Recurse',   recurse)
  490.     CALL SaveSet('TempDir',   tempdir)
  491.  
  492.     ipath = LoadSet('TargetDir',  'PPaint:Pictures')
  493.  
  494.     RequestPath '"'txt_title_path'" PATH "'ipath'"'
  495.     IF RC = 0 THEN DO
  496.         ipath = RESULT
  497.         PARSE VALUE ipath WITH '"' uipath '"'
  498.         CALL SaveSet('TargetDir', uipath)
  499.  
  500.         IF recurse THEN
  501.             list_all = 'ALL'
  502.         ELSE
  503.             list_all = ''
  504.         tmpfname = 'T:pprx_temp.'PRAGMA('ID')
  505.         ADDRESS COMMAND 'List >'tmpfname' 'ipath' NOHEAD PAT=~(#?.info) LFORMAT="*"%s%s*"" FILES' list_all
  506.  
  507.         dir_trail = RIGHT(tempdir, 1)
  508.         IF dir_trail ~= ':' & dir_trail ~= '/' THEN
  509.             tempdir = tempdir || '/'
  510.         tempfile = tempdir || PRAGMA('ID')
  511.  
  512.         icnpltinfo = conv_icnplt.icnplt
  513.         IF cavrg & rexx_ver >= 8 THEN
  514.             icnpltinfo = icnpltinfo + 2
  515.         newicdot = (itype = 3)
  516.  
  517.         Set '"ICONS='rexx_to_iconset.itype'"'
  518.         Set '"ICONFMT='width','height','icnpltinfo','newicdot'"'
  519.  
  520.         Get 'PATHPIC'
  521.         PARSE VAR RESULT '"' save_pathpic '"'
  522.         Get 'PATHANIM'
  523.         PARSE VAR RESULT '"' save_pathanim '"'
  524.         Get 'PATHCOL'
  525.         PARSE VAR RESULT '"' save_pathcol '"'
  526.         Get 'PATHSTEN'
  527.         PARSE VAR RESULT '"' save_pathsten '"'
  528.         Get 'PATHBSH'
  529.         PARSE VAR RESULT '"' save_pathbsh '"'
  530.         Get 'PATHANBSH'
  531.         PARSE VAR RESULT '"' save_pathanbsh '"'
  532.  
  533.         SIGNAL ON Break_C
  534.  
  535.         IF OPEN('listfile', tmpfname, 'R') THEN DO
  536.             errmess = ''
  537.             DO FOREVER
  538.                 curfname = READLN('listfile')
  539.                 IF EOF('listfile') THEN
  540.                     BREAK
  541.  
  542.                 IF target THEN DO
  543.                     icon_exists = 0
  544.                     icon_name = SUBSTR(curfname, 2, LENGTH(curfname) - 2) || '.info'
  545.                     IF OPEN('iconfile', icon_name, 'R') THEN DO
  546.                         icon_exists = 1
  547.                         CALL CLOSE('iconfile')
  548.                     END
  549.                     IF ~icon_exists THEN
  550.                         ITERATE
  551.                 END
  552.  
  553.                 GetFileFormat curfname 'FULL'
  554.                 IF RC = 0 THEN DO
  555.                     pfullformat = RESULT
  556.                     PARSE VALUE pfullformat WITH '"' pformat '"' pwidth pheight pcolors pattr .
  557.                     pformat = UPPER(pformat)
  558.                     pframes = 0
  559.                     DeleteFrames 'ALL FORCE'
  560.                     SetPen 'BACKGROUND 0'
  561.                     ClearImage
  562.  
  563.                     IF pformat = 'ANIM' THEN DO
  564.                         LoadAnimation curfname 'FORCE QUIET NEW'
  565.                         IF RC ~= 0 THEN DO
  566.                             IF RC ~= 34 THEN DO
  567.                                 errmess = txt_err_load || RC
  568.                                 LEAVE
  569.                             END
  570.                             ELSE ITERATE    /* skip HAM animations */
  571.                         END
  572.                         GetFrames
  573.                         pframes = RESULT
  574.                         IF animfr = 0 THEN        /* first */
  575.                             frame = 1
  576.                         ELSE IF animfr = 1 THEN        /* middle */
  577.                             frame = (pframes + 1) % 2
  578.                         ELSE IF animfr = 2 THEN        /* last */
  579.                             frame = pframes
  580.                         ELSE DO        /* select */
  581.                             frame = SelectAnimFrame(pframes)
  582.                             IF frame = 0 THEN
  583.                                 LEAVE        /* cancelled */
  584.                         END
  585.                         SetFramePosition 'FRAME' frame
  586.                         IF icnplt > 1 THEN
  587.                             AdjustColors 'COLOR -100'
  588.                         SaveAnimation tempfile 'FORCE QUIET'
  589.                         IF RC ~= 0 THEN DO
  590.                             errmess = txt_err_save || RC
  591.                             LEAVE
  592.                         END
  593.                     END
  594.                     ELSE IF pformat = 'ANIMBRUSH' THEN DO
  595.                         LoadAnimBrush curfname 'FORCE QUIET'
  596.                         IF RC ~= 0 THEN DO
  597.                             errmess = txt_err_load || RC
  598.                             LEAVE
  599.                         END
  600.                         GetAnimBrushSettings 'FRAMES'
  601.                         pframes = RESULT
  602.                         IF animfr = 0 THEN    /* first */
  603.                             frame = 1
  604.                         ELSE IF animfr = 2 THEN    /* last */
  605.                             frame = pframes
  606.                         ELSE                            /* middle */
  607.                             frame = (pframes + 1) % 2
  608.                         SetAnimBrushSettings 'FRAME' frame
  609.                         IF icnplt > 1 THEN DO
  610.                             RC = GrayBrushPalette()
  611.                             IF RC ~= 0 THEN DO
  612.                                 errmess = txt_err_format || RC
  613.                                 LEAVE
  614.                             END
  615.                         END
  616.                         SaveAnimBrush tempfile 'FORCE QUIET'
  617.                         IF RC ~= 0 THEN DO
  618.                             errmess = txt_err_save || RC
  619.                             LEAVE
  620.                         END
  621.                     END
  622.                     ELSE IF pformat = 'PALETTE' THEN DO
  623.                         GetBestVideoMode 320 200 pcolors
  624.                         PARSE VAR RESULT scrd scrw scrh
  625.                         Set '"IMAGEW=320" "IMAGEH=200" "COLORS='pcolors'" "DISPLAY='scrd'" "SCREENW='scrw'" "SCREENH='scrh'" "ASCROLL=0"'
  626.                         IF RC ~= 0 THEN DO
  627.                             errmess = txt_err_format || RC
  628.                             LEAVE
  629.                         END
  630.                         LoadPalette curfname 'FORCE QUIET'
  631.                         IF RC ~= 0 THEN DO
  632.                             errmess = txt_err_load || RC
  633.                             LEAVE
  634.                         END
  635.                         SavePalette tempfile 'FORCE QUIET'
  636.                         IF RC ~= 0 THEN DO
  637.                             errmess = txt_err_save || RC
  638.                             LEAVE
  639.                         END
  640.                     END
  641.                     ELSE IF pformat = 'STENCIL' THEN DO
  642.                         GetBestVideoMode pwidth pheight 2
  643.                         PARSE VAR RESULT scrd scrw scrh
  644.                         Set '"IMAGEW='pwidth'" "IMAGEH='pheight'" "COLORS=2" "DISPLAY='scrd'" "SCREENW='scrw'" "SCREENH='scrh'" "ASCROLL=1"'
  645.                         IF RC ~= 0 THEN DO
  646.                             errmess = txt_err_format || RC
  647.                             LEAVE
  648.                         END
  649.                         LoadStencil curfname 'FORCE QUIET'
  650.                         IF RC ~= 0 THEN DO
  651.                             errmess = txt_err_load || RC
  652.                             LEAVE
  653.                         END
  654.                         SaveStencil tempfile 'FORCE QUIET'
  655.                         IF RC ~= 0 THEN DO
  656.                             errmess = txt_err_load || RC
  657.                             LEAVE
  658.                         END
  659.                     END
  660.                     ELSE DO
  661.                         IF ftype = 0 THEN DO  /* auto */
  662.                             IF (pwidth = 320  |,
  663.                                 pwidth = 640  |,
  664.                                 pwidth = 800  |,
  665.                                 pwidth = 1024 |,
  666.                                 pwidth = 1120 |,
  667.                                 pwidth = 1152 |,
  668.                                 pwidth = 1280 |,
  669.                                 pwidth = 1600) &,
  670.                                (pheight = 200 |,
  671.                                 pheight = 240 |,
  672.                                 pheight = 256 |,
  673.                                 pheight = 400 |,
  674.                                 pheight = 480 |,
  675.                                 pheight = 512 |,
  676.                                 pheight = 768 |,
  677.                                 pheight = 832 |,
  678.                                 pheight = 900 |,
  679.                                 pheight = 960 |,
  680.                                 pheight = 1024 |,
  681.                                 pheight = 1200) THEN
  682.                                 is_image = 1
  683.                             ELSE
  684.                                 is_image = 0
  685.                         END
  686.                         ELSE IF ftype = 1 THEN DO  /* image */
  687.                             IF pwidth < 320 | pheight < 200 THEN
  688.                                 is_image = 0
  689.                             ELSE
  690.                                 is_image = 1
  691.                         END
  692.                         ELSE  /* brush */
  693.                             is_image = 0
  694.  
  695.                         IF is_image THEN DO
  696.                             LoadImage curfname 'FORCE QUIET'
  697.                             IF RC ~= 0 THEN DO
  698.                                 errmess = txt_err_load || RC
  699.                                 LEAVE
  700.                             END
  701.                             IF icnplt > 1 THEN
  702.                                 AdjustColors 'COLOR -100'
  703.                             SaveImage tempfile 'FORCE QUIET'
  704.                             IF RC ~= 0 THEN DO
  705.                                 errmess = txt_err_save || RC
  706.                                 LEAVE
  707.                             END
  708.                         END
  709.                         ELSE DO
  710.                             LoadBrush curfname 'FORCE QUIET'
  711.                             IF RC ~= 0 THEN DO
  712.                                 errmess = txt_err_load || RC
  713.                                 LEAVE
  714.                             END
  715.                             IF icnplt > 1 THEN DO
  716.                                 RC = GrayBrushPalette()
  717.                                 IF RC ~= 0 THEN DO
  718.                                     errmess = txt_err_format || RC
  719.                                     LEAVE
  720.                                 END
  721.                             END
  722.                             SaveBrush tempfile 'FORCE QUIET'
  723.                             IF RC ~= 0 THEN DO
  724.                                 errmess = txt_err_save || RC
  725.                                 LEAVE
  726.                             END
  727.                         END
  728.                     END
  729.  
  730.                     IF rexx_ver >= 8 THEN DO
  731.                         GetFileFormat tempfile 'FULL'
  732.                         IF RC = 0 THEN DO
  733.                             IF pfullformat ~= RESULT THEN
  734.                                 CALL FixToolTypes(tempfile, pfullformat, pframes)
  735.                         END
  736.                     END
  737.                     IF rexx_ver >= 8 THEN
  738.                         CopyIcon tempfile curfname
  739.                     ELSE DO
  740.                         icon_name = INSERT('.info', curfname, LENGTH(curfname)-1)
  741.                         ADDRESS COMMAND 'Copy 'tempfile'.info' icon_name
  742.                     END
  743.                 END
  744.             END
  745.             IF errmess ~= '' THEN
  746.                 RequestNotify 'PROMPT "'errmess'"'
  747.         END
  748.         ELSE tmpfname = ''
  749.  
  750.         CALL Break_C
  751.     END
  752. END
  753. UnlockGUI
  754.  
  755. EXIT 0
  756.  
  757.  
  758.  
  759.  
  760. SelectAnimFrame:
  761.  
  762.     GetFramePosition
  763.     frm = RESULT
  764.  
  765.     DO FOREVER
  766.         Request '"'txt_title_frame'" KEEPCOLORS ' ||,
  767.                 '"SLIDE = ""'txt_gad_frame'"", 1, 'ARG(1)', 'frm' ' ||,
  768.                  'ACTION = PROCEED ' ||,
  769.                  'ACTION = ""'txt_gad_show'"" ' ||,
  770.                  'ACTION = CANCEL "'
  771.         IF RC = 0 THEN DO
  772.             frm = RESULT.1
  773.             IF RESULT = 2 THEN    /* Show */
  774.                 SetFramePosition 'FRAME' frm
  775.             ELSE
  776.                 LEAVE
  777.         END
  778.         ELSE DO    /* cancelled */
  779.             frm = 0
  780.             LEAVE
  781.         END
  782.     END
  783.     RETURN frm
  784.  
  785.  
  786.  
  787.  
  788. GrayBrushPalette: PROCEDURE
  789.  
  790.     GetBrushAttributes COLORS
  791.     bcolors = RESULT
  792.     GetBestVideoMode 320 200 bcolors
  793.     PARSE VAR RESULT scrd scrw scrh
  794.     Set '"IMAGEW=320" "IMAGEH=200" "COLORS='bcolors'" "DISPLAY='scrd'" "SCREENW='scrw'" "SCREENH='scrh'" "ASCROLL=0"'
  795.     IF RC ~= 0 THEN
  796.         RETURN RC
  797.  
  798.     UseBrushPalette
  799.     AdjustColors 'COLOR -100'
  800.     CopyPaletteToBrush
  801.  
  802.     RETURN 0
  803.  
  804.  
  805.  
  806.  
  807. FixToolTypes: PROCEDURE
  808.  
  809.     file = ARG(1)
  810.     PARSE VALUE ARG(2) WITH '"' pformat '"' pwidth pheight pcolors pattr .
  811.     pframes = ARG(3)
  812.  
  813.     SetToolType file 'REPLACE "FILETYPE='pformat'"'
  814.     SetToolType file 'REPLACE "IMGFORMAT='pwidth'×'pheight', 'pcolors' COL"'
  815.     SetToolType file 'REPLACE "ANIMFORMAT='pwidth'×'pheight', 'pcolors' COL, 'pframes' FRM"'
  816.     SetToolType file 'REPLACE "ANIMBFORMAT='pwidth'×'pheight', 'pcolors' COL, 'pframes' FRM"'
  817.     SetToolType file 'REPLACE "COLORS='pcolors'"'
  818.     SetToolType file 'REPLACE "STENCILFORMAT='pwidth'×'pheight'"'
  819.  
  820.     RETURN
  821.  
  822.  
  823.  
  824.  
  825. SaveSet: PROCEDURE
  826.  
  827.     sname = ARG(1)
  828.     val = ARG(2)
  829.  
  830.     IF OPEN('settingfile', 'ENV:PP_MakeIcons_'sname, 'W') THEN DO
  831.         CALL WRITECH('settingfile', val)
  832.         CALL CLOSE('settingfile')
  833.     END
  834.  
  835.     RETURN
  836.  
  837.  
  838.  
  839.  
  840. LoadSet: PROCEDURE
  841.  
  842.     sname = ARG(1)
  843.     def_val = ARG(2)
  844.  
  845.     val = def_val
  846.     set_fname = 'ENV:PP_MakeIcons_'sname
  847.  
  848.     IF OPEN('settingfile', set_fname, 'R') THEN DO
  849.         val = READCH('settingfile', 65535)
  850.         CALL CLOSE('settingfile')
  851.     END
  852.  
  853.     RETURN val
  854.  
  855.  
  856.  
  857.  
  858. Break_C:
  859.  
  860.     DeleteFrames 'ALL FORCE'
  861.     SetPen 'BACKGROUND 0'
  862.     ClearImage
  863.     UseDefaultPalette
  864.     FreeStencil
  865.     FreeBrush
  866.  
  867.     Set '"ICONS=""'save_icons'"" "'
  868.     Set '"PATHPIC=""'save_pathpic'"" "'
  869.     Set '"PATHANIM=""'save_pathanim'"" "'
  870.     Set '"PATHCOL=""'save_pathcol'"" "'
  871.     Set '"PATHSTEN=""'save_pathsten'"" "'
  872.     Set '"PATHBSH=""'save_pathbsh'"" "'
  873.     Set '"PATHANBSH=""'save_pathanbsh'"" "'
  874.  
  875.     IF tmpfname ~= '' THEN DO
  876.         CALL CLOSE('listfile')
  877.         ADDRESS COMMAND 'Delete >NIL: 'tmpfname
  878.     ENS
  879.  
  880.     ADDRESS COMMAND 'Delete >NIL: 'tempfile tempfile'.info'
  881.  
  882.     UnlockGUI
  883.  
  884.     RETURN
  885.